package com.yuyou.hxyy.service.api.security;

public class SecurityCons {
	
	public static final String student="hasRole('ROLE_STU')";
	public static final String admin="hasRole('ROLE_ADMIN')";
	
	
	
	
    public enum role {
    	ROLE_STU("ROLE_STU", 0),
    	ROLE_ADMIN("ROLE_ADMIN", 1);

        role(String name, int userType) {
        	this.name = name;
            this.userType = userType;
        }

		private String name;
		private int userType;
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public int getUserType() {
			return userType;
		}
		public void setUserType(int userType) {
			this.userType = userType;
		}
        
        public static String getNameByType(int userType){
        	for (role r : role.values()){
        		if(r.getUserType()==userType)
        			return r.getName();
        	}
        	return null;
        }

    }
}
